#include <gtest/gtest.h>
#include <logger/logger.h>
#include "scheduler/delay_scheduler.h"
#include "scheduler/sequence_scheduler.h"
#include "scheduler/scheduler_factory.h"
#include "task/task_factory.h"
#include "../sample/battery_level_check.h"
#include "../sample/navigation_task.h"

TEST(test_delay_scheduler_set_task, test_delay_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");

    auto delay_scheduler = scheduler::SchedulerFactory<scheduler::DelayScheduler>::createScheduler("delay_scheduler", 3000);

    delay_scheduler->setTask(battery_level_check);

    delay_scheduler->run();

    EASE_INFO("done");
}

TEST(test_delay_scheduler_set_task_no_time, test_delay_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");

    auto delay_scheduler = scheduler::SchedulerFactory<scheduler::DelayScheduler>::createScheduler("delay_scheduler");
    delay_scheduler->setDelayTime(10000);

    delay_scheduler->setTask(battery_level_check);

    delay_scheduler->run();

    EASE_INFO("done");
}


TEST(test_delay_scheduler_set_scheduler, test_delay_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto navigation = task::TaskFactory<NavigationTask>::createTask("navigation");

    auto sequence_scheduler = scheduler::SchedulerFactory<scheduler::SequenceScheduler>::createScheduler("sequence_scheduler");
    sequence_scheduler->appendTask(battery_level_check);
    sequence_scheduler->appendTask(navigation);

    auto delay_scheduler = scheduler::SchedulerFactory<scheduler::DelayScheduler>::createScheduler("delay_scheduler", 10000);

    delay_scheduler->setScheduler(sequence_scheduler);

    delay_scheduler->run();

    EASE_INFO("done");
}
